﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Huirui.Cavan.Core.Extension;
using Huirui.Cavan.Domain.MainBoundedContext.ReportModule;
using Spring.Data.Generic;

namespace Huirui.Cavan.Infrastructure.Data.MainBoundedContext.StockModule
{
    public class StockByPurchaseOrderReportMapper : IRowMapper<StockByPurchaseOrderReport>
    {
        #region IRowMapper<StockByPurchaseOrderReport> 成员

        public StockByPurchaseOrderReport MapRow(System.Data.IDataReader reader, int rowNum)
        {
            StockByPurchaseOrderReport report = new StockByPurchaseOrderReport();
            report.Address = Convert.ToString(reader["Address"]);
            report.Code = Convert.ToString(reader["Code"]);
            report.CurrentStockInNumber = 0;
            report.CurrentStockInPrice = 0;
            report.DeliveryDate = Convert.ToDateTime(reader["DeliveryDate"]).ToShortDateString();
            report.Name = Convert.ToString(reader["Name"]);
            report.Number = Convert.ToDecimal(reader["Number"]);
            report.PurchaseOrderCode = Convert.ToString(reader["PurchaseOrderCode"]);
            report.SupplierName = Convert.ToString(reader["SupplierName"]);
            report.UnStockInNumber = Convert.ToDecimal(reader["UnStockInNumber"]);
            report.Specification = Convert.ToString(reader["Specification"]);
            report.TaxRate = Convert.ToDecimal(reader["TaxRate"]);
            report.CurrentStockInPrice = Convert.ToDecimal(reader["StandardPurchasePrice"]);
            report.FromNumber = Convert.ToDecimal(reader["FromNumber"]);
            report.ToNumber = Convert.ToDecimal(reader["ToNumber"]);

            return report;
        }

        #endregion
    }
}
